#ifndef _main__h   
#define __main_h
//HAL--------------------
		

        
//Const--------------------
//base 4ms
#define D_1s         250   //1s
#define D_40ms       10    //40ms
#define D_300ms   75 //300ms
#define D_500ms      125     //500ms
 #define D_1m        60

#define F_clrPower  P1_4=0
#define F_setPower  P1_4=1

#define D_keyYuYue  3
#define D_keyUp   4
#define D_keySheZhi 5
#define D_keyDown   6 
#define D_keyKaiGuan 1
#define D_keyTG_ZR 2 

#define setOrtherLed  P0_4=1; P3_3=1;P0_3=1;
#define clrOrtherLed  P0_4=0; P3_3=0;P0_3=0;


#define setRed  P2_1=1
#define clrRed  P2_1=0

#define setBlue  P0_0=1
#define clrBlue  P0_0=0
//Var----------------------
#ifdef  MAIN_C 
uint8_t  data timer1s;
	uint8_t data   timer40ms; 
	uint8_t data  timer300ms;
	uint8_t data   timer500ms; 
	uint8_t  data timer1m;
 uint8_t  data  keyValue;
uint8_t  data longKeyHoldTime;
uint8_t data  longKeyValue;
uint8_t data  holdKey;
uint8_t  data longKeyJudgeTime;
bit  data  bStart;
bit data  bSecFlash500ms;






bit data   bPowerOnOff;
uint8_t  data setCurTemp;
uint8_t  data gear;
uint8_t data  function;
uint8_t data  flashSheZhi;
uint8_t data  sheZhiNum;
uint8_t data  yuYueNum;
bit data  bOrderOpen;
bit data  bOrderClose;
uint8_t  data mainClockHour;
uint8_t data  mainClockMin;
uint8_t  data MorderClockOpenHour;
uint8_t  data MorderClockOpenMin;
uint8_t data  MorderClockCloseHour;
uint8_t  data MorderClockCloseMin;
uint8_t  data AorderClockOpenHour;
uint8_t  data AorderClockOpenMin;
uint8_t  data AorderClockCloseHour;
uint8_t  data AorderClockCloseMin;
uint8_t data  NorderClockOpenHour;
uint8_t data  NorderClockOpenMin;
uint8_t data  NorderClockCloseHour;
uint8_t  data NorderClockCloseMin;
bit  data bSaveTemp;
bit  data bNoClock;
uint8_t  data mainClockMiao;
bit  data bError;
bit  data bOpenBuzz;
bit  data bSecFlash300ms;
 #else
	 extern bit data  bSecFlash300ms;
	 extern bit data  bOpenBuzz;
	extern bit  data bError;
	extern bit data  bNoClock;
extern uint8_t  data mainClockMiao;
 extern bit data  bSaveTemp;
extern bit   data bPowerOnOff;
extern uint8_t  data setCurTemp;
extern uint8_t  data gear;
extern uint8_t  data function;
extern uint8_t  data flashSheZhi;
extern uint8_t  data sheZhiNum;
extern uint8_t data  yuYueNum;
extern bit  data bOrderOpen;
extern bit data  bOrderClose;
extern uint8_t data  mainClockHour;
extern uint8_t data  mainClockMin;
extern uint8_t data  MorderClockOpenHour;
extern uint8_t data  MorderClockOpenMin;
extern uint8_t data  MorderClockCloseHour;
extern uint8_t data  MorderClockCloseMin;
extern uint8_t data  AorderClockOpenHour;
extern uint8_t data  AorderClockOpenMin;
extern uint8_t data  AorderClockCloseHour;
extern uint8_t data  AorderClockCloseMin;
extern uint8_t data  NorderClockOpenHour;
extern uint8_t data  NorderClockOpenMin;
extern uint8_t data  NorderClockCloseHour;
extern uint8_t data  NorderClockCloseMin;
 
extern bit  data bSecFlash500ms; 
extern uint8_t data  longKeyHoldTime;
extern uint8_t data  longKeyValue;
extern uint8_t data  holdKey;
extern uint8_t  data longKeyJudgeTime;
extern  bit data   bStart;
extern  uint8_t  data  keyValue;
extern uint8_t data  timer1s;
	extern uint8_t   data timer40ms; 
	extern uint8_t data  timer300ms;
	extern uint8_t  data  timer500ms; 


 #endif
   

//Function----------------------
void keyZR();
void functionChoice();
void	remKey();
void OrderOpen();
void  setSheZhi();
void timerControl();
void getKey();
void keyKaiGuan();
void keyYuYue();
void keyTG();
void keySheZhi();
void keyUp();
void keyDown();
void PowerOff();
void PowerSet();
 void Error();
#endif